export default class Member {
    static KIND: string = 'Member';

    static Keys = {
        ID: 'id',
        MEMBER_RONIN_WALLET_ADDRESS: 'member_ronin_wallet_address',
        MANAGER_RONIN_WALLET_ADDRESS: 'manager_ronin_wallet_address',
        NAME: 'name',
        EMAIL: 'email',
        TIMESTAMP: 'timestamp',
        TIMESTAMP_LAST_UPDATED: 'timestamp_last_updated',
    };

    key: {};
    id: number;
    name: string;
    memberRoninWalletAddress: string;
    managerRoninWalletAddress: string;
    email: string;
    timestamp: number;
    timestampLastUpdated: number;

    static fromJSON = (data: {}): Member => {
        const member = new Member();

        member.id = data[Member.Keys.ID];
        member.memberRoninWalletAddress = data[Member.Keys.MEMBER_RONIN_WALLET_ADDRESS];
        member.managerRoninWalletAddress = data[Member.Keys.MANAGER_RONIN_WALLET_ADDRESS];
        member.name = data[Member.Keys.NAME];
        member.email = data[Member.Keys.EMAIL];
        member.timestamp = data[Member.Keys.TIMESTAMP];
        member.timestampLastUpdated = data[Member.Keys.TIMESTAMP_LAST_UPDATED];

        return member;
    };
}

export interface TopMemberResponse {
    member: Member;
    organization: {
        email: string;
        id: number;
        name: string;
        wallet_address: string;
    };
    slp: number;
    total_amount_in_usd: number;
}
